function output = processOutput(i,dim,elements,model,...
    output,postProcessInfo,processInfo)
npp = size(postProcessInfo.infoList,2);
for j=1:npp
    req = postProcessInfo.infoList{j};
    if strcmp(req,'resistant force')
        riFull = computeResistantForce...
            (elements,model,processInfo);
        param = postProcessInfo.infoParam{j};
        nn = size(param,2);
        cnt2 = 1;
        for k=1:nn
            nodeid = param(k);
            output.resistant_force(:,cnt2,i) = ...
                riFull([nodeid*dim-1 nodeid*dim]);
            cnt2 = cnt2+1;
        end
    end
    if strcmp(req,'stress at Gauss points')
        param = postProcessInfo.infoParam{j};
        ne = size(param,2);
        if strcmp(processInfo.integrationType,...
                'implicit')
            for k=1:ne
                eid = param(k);
                output.stress_gp(:,:,k,i) = ...
                    elements(eid).stress;
            end
        elseif strcmp(processInfo.integrationType,...
                'implex')
            for k=1:ne
                eid = param(k);
                output.stress_gp(:,:,k,i) = ...
                    elements(eid).stressImplicit;
            end
        end
    end
    if strcmp(req,'strain plot for softening')
        %         param = postProcessInfo.infoParam{j};
        %         handle = param{1};
        %         set(0,'CurrentFigure',handle);
        %         hold on;
        %         e = param{2};
        %         ne = size(e,2);
        %         for k=1:ne
        %             eid = e(k);
        %             stress = elements(eid).stress;
        %             kappa = elements(eid).kappa
        %             d = computeDamageVariable(elements(eid),kappa);
        %             strain = (elements(i).elasticConstitutiveMatrix\...
        %                 stress)/(1-d);
        % %             output.strain_gp(:,:,k,i) = strain;
        %             plot(i,d,'x');
        %         end
    end
    if strcmp(req,'damage at Gauss points')
        param = postProcessInfo.infoParam{j};
        ne = size(param,2);
        for k=1:ne
            eid = param(k);
            output.damage_gp(:,k,i) = ...
                elements(eid).damage;
        end
    end
    if strcmp(req,'write damage at Gauss points to gid')
        gid = postProcessInfo.infoParam{j};
        ne = model.countElements();
        for k=1:ne
            d(k,:) = elements(k).damage;
        end
        gid.writeGausspointScalarResult('DAMAGE',...
            'Triangle',d,i);
    end
    if strcmp(req,'check sigma1')
        findMaximumPrincipalStress(elements);
    end
    if strcmp(req,'crack opening Linder')
        ne = model.countElements();
        for k=1:ne
            if elements(k).isCrack
                %                 opening = (elements(k).Xi)'*elements(k).normal;
                %                 disp(['element ' num2str(k) ' normal crack opening: '...
                %                     num2str(opening)]);
                
                %                 opening = (elements(k).Xi)';
                %                 disp(['element ' num2str(k) ' crack opening vector: '...
                %                     num2str(opening)]);
                
                if strcmp(elements(k).mode,'constant')
                    J = computeJ(elements(k));
                    opening = J*elements(k).Xi;
                    disp(['element ' num2str(k) ' crack opening: '...
                        num2str(opening')]);
                elseif strcmp(elements(k).mode,'linear')
                    J = computeJ(elements(k),0);
                    opening = J*elements(k).Xi;
                    disp(['element ' num2str(k) ' crack opening in the middle: '...
                        num2str(opening')]);
                end
            end
        end
    end
    if strcmp(req,'crack opening Jirasek')
        ne = model.countElements();
        for k=1:ne
            if elements(k).isCrack
                opening = (elements(k).e)';
                disp(['element ' num2str(k) ' crack opening: '...
                    num2str(opening)]);
            end
        end
    end
    if strcmp(req,'damage parameter Jirasek')
        ne = model.countElements();
        for k=1:ne
            if elements(k).isCrack
                gamma = elements(k).gamma;
                disp(['damage parameter at element ' num2str(k) ': ' ...
                    num2str(gamma)]);
            end
        end
    end
    if strcmp(req,'vonmises-gid writer')
        post = postProcessInfo.infoParam{j};
        post.writeMesh(model,i);
        mesh = model.getMesh();
        nn = mesh.countNodes();
        dim = mesh.getDimension();
        ne = model.countElements();
        elemType = model.getElement(0).getElemType();
        %extract u
        for k=1:nn
            u(k,:) = mesh.getNode(k-1).getUHatLocal();
        end
        post.writeNodalVectorResult('DISPLACEMENT',u,i);
        %extract stress
        for k=1:ne
            e = model.getElement(k-1);
            ng = e.getNumGaussPoint();
            for l=1:ng
                sigma = elements(k).stress(:,l);
                if dim == 2
                    s(k,l,:) = [sigma(1) sigma(2) 0 sigma(3) 0 0];
                elseif dim == 3
                    s(k,l,:) = sigma;
                end
                
            end
        end
        post.writeGausspointMatrixResult('CAUCHY_STRESS',elemType,s,i);
        %extract plastic strain
        for k=1:ne
            e = model.getElement(k-1);
            ng = e.getNumGaussPoint();
            for l=1:ng
                epsilonp = elements(k).ep(:,l);
                if dim == 2
                    Epsilonp(k,l,:) = [epsilonp(1) epsilonp(2) 0 ...
                        epsilonp(3)/2 0 0];
                elseif dim == 3
                    Epsilonp(k,l,:) = epsilonp;
                end
                
            end
        end
        post.writeGausspointMatrixResult('PLASTIC_TRAIN',elemType,Epsilonp,i);
    end
    if strcmp(req,'plot stress field')
        
    end
end
end
